package com.tepth.vehiclemaintenance.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.tepth.vehiclemaintenance.bean.VehicleMaintain;
import com.tepth.vehiclemaintenance.mvp.work.content.ContentFragment;
import com.tepth.vehiclemaintenance.mvp.work.history.HistoryFragment;


/**
 * Created by YoKeyword on 16/6/5.
 */
public class FragmentAdapter extends FragmentPagerAdapter {
    private String[] mTab = new String[]{"保养作业", "保养历史"};
    private VehicleMaintain mVehicleMaintain;
    public FragmentAdapter(FragmentManager fm,VehicleMaintain vehicleMaintain) {
        super(fm);
        mVehicleMaintain = vehicleMaintain;
    }

    @Override
    public Fragment getItem(int position) {
        if (position == 0) {
            return ContentFragment.newInstance(mVehicleMaintain);
        } else {
            return HistoryFragment.newInstance(mVehicleMaintain);
        }
    }

    @Override
    public int getCount() {
        return mTab.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTab[position];
    }
}
